package homework.exp06;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Scanner;

public class E {
    static Scanner cin = null;

    static {
        try {
            cin = new Scanner(new FileInputStream(new File("src/homework/exp06/E.in")));
        } catch (IOException e) {
            cin = new Scanner(System.in);
        }
    }
    public static void main(String[] args) {
        while(cin.hasNext()) {
            int n = cin.nextInt();
            if(n==0)
                break;
            String a[] = new String[10000];
            String b[] = new String[10000];
            int sum[] = new int[10000];
            for(int i=0;i<n;i++) {
                a[i]=cin.next();
                b[i]=cin.next();
                sum[i]=1;
            }
            for(int i=0;i<n;i++) {
                for(int j=0;j<n;j++) {
                    if(a[i].equals(b[j])) {
                        sum[i]=0;
                    }
                }
            }
            int flag=1;
            int k=0;
            int c[] = new int[10000];
            for(int i=0;i<n;i++) {
                if(sum[i]==1)
                    c[k++]=i;
            }
            for(int j=1;j<k;j++)
                if(a[c[j]].equals(a[c[0]]))
                    flag++;
            if(flag==k)
                System.out.println("Yes");
            else
                System.out.println("No");
        }
    }
}